<!--
    Copyright 2008 Jan Molnar <jan.molnar@abds.de>

    This file is part of JCQ.

    JCQ is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    JCQ is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with JCQ. If not, see <http://www.gnu.org/licenses/>.
-->

<Page x:Class="EditIdentityPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    WindowTitle="JCQ - Edit identity" Name="wnd">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="20" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Label   Content="Name:" VerticalAlignment="Center" />
        <TextBox   Margin="8"  Grid.Column="1" Name="txtName" ToolTip="Enter your Screenname here. Others can use this name to identify you." />
        <Label    Content="UIN:" Grid.Row="1" VerticalAlignment="Center" />
        <TextBox  Margin="8" Grid.Row="1"  Grid.Column="1" Name="txtUin" ToolTip="Enter your ICQ UIN." />
        <Label    VerticalAlignment="Center" Grid.Row="2" Content="Password:" />
        <PasswordBox  Margin="8" Name="txtPassword"  Grid.Column="1" Grid.Row="2" ToolTip="Enter your ICQ Password." />

        <Label  VerticalAlignment="Center" Grid.Row="3" Content="Avatar:" />
        <Grid Grid.Column="1" Grid.Row="3" DataContext="{Binding ElementName=wnd}" Margin="8">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <ListBox Grid.ColumnSpan="2" IsSynchronizedWithCurrentItem="True" SelectedItem="{Binding ViewModel.ImageSelector.SelectedImageFile}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding ViewModel.ImageSelector.ImageFiles}">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel IsItemsHost="True" />
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Border CornerRadius="4" BorderBrush="Gray" BorderThickness="2" Margin="2">
                            <Image Width="48" Height="48" Source="{Binding }" />
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
                <Button Content="Add new image" Click="OnAddNewImageClick" />
            </StackPanel>
        </Grid>

        <StackPanel Grid.Column="1" Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Height="23" Margin="8,8,0,8" Width="80" Click="OnUpdateClick" >Update</Button>
            <Button Height="23" Margin="8,8,0,8" Width="80" Click="OnDeleteIdentityClick" >Delete</Button>
            <Button Height="23" Margin="8" Width="80" Click="OnCancelClick" >Cancel</Button>
        </StackPanel>
    </Grid>
</Page>
